DEFINITION MODULE Break;

(* (C) Copyright 1987,1988 Fitted Software Tools. All rights reserved. *)

(*
    This module allows the user to trap the Ctrl-Break (vector 1BH)
    interrupt and the DOS generated (vector 23H) Ctrl-C interrupt.

    Upon initialization, BREAK is disabled. Ths user program must
    call EnableBreak to allow processing of breaks.

    The break interrupt handlers check the DOS busy flag to prevent
    Ctrl-Break processing while in DOS.

    The default break handler simply terminates the program (ErrorLevel 6).

    DisableBreak is called before control is transfered to a user
    break handler. Should the user break handler procedure return,
    the program is terminated (ErrorLevel 6).

    Uses: To prevent the user from terminating the program via Ctrl-Break
          or Ctrl-C, just import this module.

          During program testing, it is useful to include this module and
          invoke EnableBreak; This allows the program to be aborted via
          Ctrl-Break, even if the program goes into a loop.
*)

PROCEDURE EnableBreak;
(*
    enable processing of BREAK.
    the default break handler will terminate the program
*)

PROCEDURE DisableBreak;
(*
    disable processing of BREAK
*)

PROCEDURE InstallBreakHandler( breakHandler :PROC );
(*
    install procedure to gain control if a BREAK is detected.
*)

PROCEDURE UninstallBreakHandler;
(*
    uninstall the user BREAK handler procedure
*)

END Break.